$(function() {

    var left;
    var $hexagon = $('img.hexagon');
    $hexagon.each(function(index, el) {
        var $imgText = $(this).prev();
        var textWidth = $imgText.outerWidth();
        var imgWidth = $(this).outerWidth();

        var left = index * textWidth + (textWidth - imgWidth) / 2;
        $(this).css('left', left + 'px');
    });

    var pi = 0, ti = 0;//设置为全局
    var $btnPlat = $(".btn-plat");
    var platTimer = window.setInterval(function() {
        // console.log($(".leftBnt1-top li"))
        pi = pi % $btnPlat.length;
        $btnPlat.removeClass("current");
        $btnPlat.eq(pi).addClass("current");
        pi++;
        
    }, 2000);

    var $btnInner = $(".box-aliyun .btn-inner");
    var aliyunTimer = window.setInterval(function() {
        var index = Math.round(Math.random() * $btnInner.length);

        $btnInner.removeClass("current");
        $btnInner.eq(index).addClass("current");
        
    }, 1000);

    var $third = $(".box-aliyun .btn-inner-round"), thirdlen = $third.length;
    var thirdTimer = window.setInterval(function() {
        if (ti > (thirdlen - 1)) {
            ti = ti - thirdlen - 1;
        }
        $third.removeClass("current");
        $third.eq(ti%thirdlen).addClass("current");
        if (ti == (thirdlen - 1)) {
            ti = 0;
        } else {
            ti += 2;
        }
        
        
    }, 1500);

    var $aliyunImg = $('#aliyun-row img');
   
    rotateImg($aliyunImg);

})